home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gdevbjcl.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  12.9 KB  |  402 lines

  1. /* Copyright (C) 1998 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gdevbjcl.h,v 1.2 2000/09/19 19:00:11 lpd Exp $*/
  20. /* Canon BJC command generation library interface */
  21.  
  22. /****** PRELIMINARY, SUBJECT TO CHANGE WITHOUT NOTICE. ******/
  23.  
  24. #ifndef gdevcbjc_INCLUDED
  25. #  define gdevcbjc_INCLUDED
  26.  
  27. #include <stdio.h>            /* ****** PATCH FOR stream.h ****** */
  28. #include "stream.h"
  29.  
  30. /*
  31.  * These procedures generate command strings for the Canon BJC family of
  32.  * printers.  Note that not all printers support all commands.
  33.  */
  34.  
  35. /* ---------------- Printer capabilities ---------------- */
  36.  
  37. /*
  38.  * Different printer models implement different subsets of the command set.
  39.  * We define a mask bit for each capability, and a mask for each printer
  40.  * indicating which capabilities it supports.  In some cases, a capability
  41.  * is a parameter value for a command rather than a separate command.
  42.  */
  43.  
  44. /*
  45.  * Single-character commands.
  46.  *
  47.  * All BJC models implement CR and FF.
  48.  */
  49. #define BJC_OPT_NUL 0x00000001
  50. #define BJC_OPT_LF  0x00000002
  51.  
  52. /*
  53.  * Session commands.
  54.  *
  55.  * All BJC models implement Set initial condition, Initialize,
  56.  * Print method, and Media Supply.
  57.  */
  58. #define BJC_OPT_IDENTIFY_CARTRIDGE   0x00000004
  59. #define BJC_OPT_MONOCHROME_SMOOTHING 0x00000008    /* for bjc_print_color_t */
  60.  
  61. /*
  62.  * Page commands.
  63.  *
  64.  * All BJC models implement Page margins.
  65.  */
  66. #define BJC_OPT_EXTENDED_MARGINS 0x00000010
  67. #define BJC_OPT_PAGE_ID          0x00000020
  68.  
  69. /*
  70.  * Resolution.  This varies considerably from model to model.
  71.  * The _300 or _360 option gives the base resolution; the other options
  72.  * indicate which multiples of the base are available.
  73.  * Note that the resolution multipliers are specified as X, then Y.
  74.  */
  75. #define BJC_OPT_RESOLUTION_360     0x00000040
  76. #define BJC_OPT_RESOLUTION_300     0x00000080
  77. #define BJC_OPT_RESOLUTION_HALF    0x00000100 /* 180 or 150 */
  78. #define BJC_OPT_RESOLUTION_QUARTER 0x00000200 /* 90 or 75 */
  79. #define BJC_OPT_RESOLUTION_2X      0x00000400 /* 720 or 600 */
  80. #define BJC_OPT_RESOLUTION_2X_1X   0x00000800
  81. #define BJC_OPT_RESOLUTION_4X_2X   0x00001000
  82.  
  83. /*
  84.  * Image commands.
  85.  *
  86.  * All BJC models implement Raster resolution, Raster skip, CMYK image,
  87.  * and Data compression.
  88.  */
  89. #define BJC_OPT_X_Y_RESOLUTION      0x00002000    /* for raster_resolution */
  90. #define BJC_OPT_MOVE_LINES          0x00004000
  91. #define BJC_OPT_IMAGE_FORMAT        0x00008000
  92. #define BJC_OPT_CONTINUE_IMAGE      0x00010000
  93. #define BJC_OPT_INDEXED_IMAGE       0x00020000
  94. #define BJC_OPT_SET_COLOR_COMPONENT 0x00040000
  95.  
  96. /*
  97.  * Define the capabilities of the models that we know about.
  98.  */
  99. /*
  100.  * We don't have the documentation for the 50, but Canon says it's the
  101.  * same as the 80.
  102.  */
  103. #define BJC_OPT_50\
  104.   (BJC_OPT_NUL | BJC_OPT_LF |\
  105.    BJC_OPT_IDENTIFY_CARTRIDGE |\
  106.    BJC_OPT_EXTENDED_MARGINS | BJC_OPT_PAGE_ID |\
  107.    BJC_OPT_RESOLUTION_360 | BJC_OPT_RESOLUTION_HALF |\
  108.      BJC_OPT_RESOLUTION_QUARTER | BJC_OPT_RESOLUTION_2X_1X |\
  109.    BJC_OPT_X_Y_RESOLUTION | BJC_OPT_MOVE_LINES | BJC_OPT_IMAGE_FORMAT |\
  110.      BJC_OPT_CONTINUE_IMAGE)
  111. #define BJC_OPT_70\
  112.   (BJC_OPT_LF |\
  113.    BJC_OPT_IDENTIFY_CARTRIDGE | BJC_OPT_MONOCHROME_SMOOTHING |\
  114.    BJC_OPT_RESOLUTION_360)
  115. #define BJC_OPT_80\
  116.   BJC_OPT_50
  117. #define BJC_OPT_210\
  118.   (BJC_OPT_IDENTIFY_CARTRIDGE | BJC_OPT_MONOCHROME_SMOOTHING |\
  119.    BJC_OPT_EXTENDED_MARGINS |\
  120.    BJC_OPT_RESOLUTION_360 |\
  121.    BJC_OPT_X_Y_RESOLUTION | BJC_OPT_MOVE_LINES | BJC_OPT_CONTINUE_IMAGE)
  122. #define BJC_OPT_250\
  123.   (BJC_OPT_LF |\
  124.    BJC_OPT_IDENTIFY_CARTRIDGE | BJC_OPT_MONOCHROME_SMOOTHING |\
  125.    BJC_OPT_EXTENDED_MARGINS | BJC_OPT_PAGE_ID |\
  126.    BJC_OPT_RESOLUTION_360 | BJC_OPT_RESOLUTION_HALF |\
  127.      BJC_OPT_RESOLUTION_QUARTER | BJC_OPT_RESOLUTION_2X_1X |\
  128.    BJC_OPT_X_Y_RESOLUTION | BJC_OPT_MOVE_LINES | BJC_OPT_IMAGE_FORMAT |\
  129.      BJC_OPT_CONTINUE_IMAGE)
  130. #define BJC_OPT_610\
  131.   (BJC_OPT_LF |\
  132.    BJC_OPT_RESOLUTION_360)
  133. #define BJC_OPT_620\
  134.   BJC_OPT_610
  135. #define BJC_OPT_4000\
  136.   (BJC_OPT_LF |\
  137.    BJC_OPT_IDENTIFY_CARTRIDGE | BJC_OPT_MONOCHROME_SMOOTHING |\
  138.    BJC_OPT_RESOLUTION_360 | BJC_OPT_RESOLUTION_HALF |\
  139.      BJC_OPT_RESOLUTION_QUARTER)
  140. #define BJC_OPT_4100\
  141.   (BJC_OPT_IDENTIFY_CARTRIDGE |\
  142.    BJC_OPT_EXTENDED_MARGINS |\
  143.    BJC_OPT_RESOLUTION_360 |\
  144.    BJC_OPT_MOVE_LINES | BJC_OPT_CONTINUE_IMAGE)
  145. #define BJC_OPT_4200\
  146.   (BJC_OPT_LF |\
  147.    BJC_OPT_IDENTIFY_CARTRIDGE |\
  148.    BJC_OPT_EXTENDED_MARGINS | BJC_OPT_PAGE_ID |\
  149.    BJC_OPT_RESOLUTION_360 |\
  150.    BJC_OPT_MOVE_LINES | BJC_OPT_IMAGE_FORMAT | BJC_OPT_CONTINUE_IMAGE)
  151. #define BJC_OPT_4300\
  152.   BJC_OPT_250
  153. #define BJC_OPT_4550\
  154.   BJC_OPT_250
  155. #define BJC_OPT_4650\
  156.   BJC_OPT_250
  157. #define BJC_OPT_5500\
  158.   (BJC_OPT_IDENTIFY_CARTRIDGE | BJC_OPT_MONOCHROME_SMOOTHING |\
  159.    BJC_OPT_EXTENDED_MARGINS |\
  160.    BJC_OPT_RESOLUTION_360 |\
  161.    BJC_OPT_MOVE_LINES | BJC_OPT_CONTINUE_IMAGE)
  162. /* The 7000 is not well documented.  The following is a semi-guess. */
  163. #define BJC_OPT_7000\
  164.   (BJC_OPT_NUL | BJC_OPT_LF |\
  165.    BJC_OPT_IDENTIFY_CARTRIDGE |\
  166.    BJC_OPT_EXTENDED_MARGINS | BJC_OPT_PAGE_ID |\
  167.    BJC_OPT_RESOLUTION_300 | BJC_OPT_RESOLUTION_2X_1X |\
  168.      BJC_OPT_RESOLUTION_4X_2X |\
  169.    BJC_OPT_MOVE_LINES | BJC_OPT_IMAGE_FORMAT | BJC_OPT_CONTINUE_IMAGE |\
  170.      BJC_OPT_INDEXED_IMAGE | BJC_OPT_SET_COLOR_COMPONENT)
  171.  
  172. /*
  173.  * Enumerate the options for all the printer models we know about.
  174.  * m(x, y) will normally be {x, y}, to generate a table.
  175.  */
  176. #define BJC_ENUMERATE_OPTIONS(m)\
  177.   m(50, BJC_OPT_50)\
  178.   m(70, BJC_OPT_70)\
  179.   m(80, BJC_OPT_80)\
  180.   m(210, BJC_OPT_210)\
  181.   m(250, BJC_OPT_250)\
  182.   m(610, BJC_OPT_610)\
  183.   m(620, BJC_OPT_620)\
  184.   m(4000, BJC_OPT_4000)\
  185.   m(4100, BJC_OPT_4100)\
  186.   m(4200, BJC_OPT_4200)\
  187.   m(4300, BJC_OPT_4300)\
  188.   m(4550, BJC_OPT_4550)\
  189.   m(4650, BJC_OPT_4650)\
  190.   m(5500, BJC_OPT_5500)\
  191.   m(7000, BJC_OPT_7000)
  192.  
  193. /* ---------------- Command generation ---------------- */
  194.  
  195. /*
  196.  * Single-character commands.
  197.  */
  198.  
  199. /* Carriage return (^M) */
  200. void bjc_put_CR(P1(stream *s));
  201.  
  202. /* Form feed (^L) */
  203. void bjc_put_FF(P1(stream *s));
  204.  
  205. /* Line feed (^J) */
  206. void bjc_put_LF(P1(stream *s));
  207.  
  208. /*
  209.  * Session commands.
  210.  */
  211.  
  212. /* Set initial condition */
  213. void bjc_put_initial_condition(P1(stream *s));
  214.  
  215. /* Return to initial condition */
  216. void bjc_put_initialize(P1(stream *s));
  217.  
  218. /* Select print method */
  219. /****** DIFFERENT FOR 7000 ******/
  220. typedef enum {
  221.     BJC_PRINT_COLOR_COLOR = 0x0,
  222.     BJC_PRINT_COLOR_MONOCHROME = 0x1,
  223.     BJC_PRINT_COLOR_MONOCHROME_WITH_SMOOTHING = 0x2    /* option */
  224. } bjc_print_color_t;
  225. typedef enum {
  226.     BJC_PRINT_MEDIA_PLAIN_PAPER = 0x0,
  227.     BJC_PRINT_MEDIA_COATED_PAPER = 0x1,
  228.     BJC_PRINT_MEDIA_TRANSPARENCY_FILM = 0x2,
  229.     BJC_PRINT_MEDIA_BACK_PRINT_FILM = 0x3,
  230.     BJC_PRINT_MEDIA_TEXTILE_SHEET = 0x4,
  231.     BJC_PRINT_MEDIA_GLOSSY_PAPER = 0x5,
  232.     BJC_PRINT_MEDIA_HIGH_GLOSS_FILM = 0x6,
  233.     BJC_PRINT_MEDIA_HIGH_RESOLUTION_PAPER = 0x7    /* BJC-80 only */
  234. } bjc_print_media_t;
  235. typedef enum {
  236.     BJC_PRINT_QUALITY_NORMAL = 0x0,
  237.     BJC_PRINT_QUALITY_HIGH = 0x1,
  238.     BJC_PRINT_QUALITY_DRAFT = 0x2,
  239.     BJC_PRINT_QUALITY_COLOR_NON_BLEED = 0x8    /* not 6x0 */
  240. } bjc_print_quality_t;
  241. typedef enum {
  242.     /* 6x0 only */
  243.     BJC_BLACK_DENSITY_NORMAL = 0x0,
  244.     BJC_BLACK_DENSITY_HIGH = 0x1
  245. } bjc_black_density_t;
  246. void bjc_put_print_method(P5(stream *s, bjc_print_color_t color,
  247.                  bjc_print_media_t media,
  248.                  bjc_print_quality_t quality,
  249.                  bjc_black_density_t density));
  250. typedef enum {
  251.     /* 70, 4000, 4550, 4650 */
  252.     BJC_70_PRINT_COLOR_SHORT_FINE = 0x0,        /* also 0x1, 0x2 */
  253.     BJC_70_PRINT_COLOR_SHORT_HQ = 0x3,
  254.     BJC_70_PRINT_COLOR_SHORT_ECO = 0x4,
  255.     /* 80, 250, 4200, 4300 */
  256.     BJC_80_PRINT_COLOR_SHORT_STD = 0x0,
  257.     BJC_80_PRINT_COLOR_SHORT_STD_SPECIALTY = 0x1,
  258.     BJC_80_PRINT_COLOR_SHORT_HQ_SPECIALTY = 0x2,
  259.     BJC_80_PRINT_COLOR_SHORT_HQ = 0x3,
  260.     BJC_80_PRINT_COLOR_SHORT_HIGH_SPEED = 0x4,
  261.     /* 210, 4100 */
  262.     BJC_210_PRINT_COLOR_SHORT_HQ = 0x0,    /* also 0x1 */
  263.     BJC_210_PRINT_COLOR_SHORT_FINE = 0x2,    /* also 0x3 */
  264.     BJC_210_PRINT_COLOR_SHORT_HIGH_SPEED = 0x4,
  265.     /* 5500 */
  266.     BJC_5500_PRINT_COLOR_SHORT_COATED = 0x0,
  267.     BJC_5500_PRINT_COLOR_SHORT_TRANSPARENCY = 0x1,
  268.     BJC_5500_PRINT_COLOR_SHORT_PLAIN = 0x2,
  269.     BJC_5500_PRINT_COLOR_SHORT_HQ_NON_BLEED = 0x3,
  270.     BJC_5500_PRINT_COLOR_SHORT_HIGH_SPEED = 0x4
  271. } bjc_print_color_short_t;
  272. void bjc_put_print_method_short(P2(stream *s, bjc_print_color_short_t color));
  273.  
  274. /* Set media supply method */
  275. /****** DIFFERENT FOR 7000 ******/
  276. typedef enum {
  277.     /* 70, 210, 250, 6x0, 4100 */
  278.     BJC_70_MEDIA_SUPPLY_MANUAL_1 = 0x0,
  279.     BJC_70_MEDIA_SUPPLY_MANUAL_2 = 0x1,
  280.     BJC_70_MEDIA_SUPPLY_ASF = 0x4,
  281.     /* 250, 4000, 4300, 4650, 5500 */
  282.     BJC_250_MEDIA_SUPPLY_CONTINUOUS_FORM = 0x2,
  283.     BJC_250_MEDIA_SUPPLY_ASF_BIN_2 = 0x5,
  284.     /* 250, 4650, 5500 */
  285.     BJC_250_MEDIA_SUPPLY_AUTO_SWITCH = 0xf,
  286.     /* 4000, 4300, 4650 */
  287.     BJC_4000_MEDIA_SUPPLY_CASSETTE = 0x8,
  288.     /* 80 */
  289.     BJC_80_MEDIA_SUPPLY_ASF_OFFLINE = 0x0,
  290.     BJC_80_MEDIA_SUPPLY_ASF_ONLINE = 0x1        /* also 0x4 */
  291. } bjc_media_supply_t;
  292. typedef enum {
  293.     BJC_MEDIA_TYPE_PLAIN_PAPER = 0x0,
  294.     BJC_MEDIA_TYPE_COATED_PAPER = 0x1,
  295.     BJC_MEDIA_TYPE_TRANSPARENCY_FILM = 0x2,
  296.     BJC_MEDIA_TYPE_BACK_PRINT_FILM = 0x3,
  297.     BJC_MEDIA_TYPE_PAPER_WITH_LEAD = 0x4,
  298.     BJC_MEDIA_TYPE_TEXTILE_SHEET = 0x5,
  299.     BJC_MEDIA_TYPE_GLOSSY_PAPER = 0x6,
  300.     BJC_MEDIA_TYPE_HIGH_GLOSS_FILM = 0x7,
  301.     BJC_MEDIA_TYPE_ENVELOPE = 0x8,
  302.     BJC_MEDIA_TYPE_CARD = 0x9,
  303.     BJC_MEDIA_TYPE_HIGH_RESOLUTION_6X0 = 0xa,    /* 6x0 only */
  304.     BJC_MEDIA_TYPE_HIGH_RESOLUTION = 0xb,    /* 720x720, other models */
  305.     BJC_MEDIA_TYPE_FULL_BLEED = 0xc,
  306.     BJC_MEDIA_TYPE_BANNER = 0xd
  307. } bjc_media_type_t;
  308. void bjc_put_media_supply(P3(stream *s, bjc_media_supply_t supply,
  309.                  bjc_media_type_t type));
  310.  
  311. /* Identify ink cartridge */
  312. typedef enum {
  313.     BJC_IDENTIFY_CARTRIDGE_PREPARE = 0x0,
  314.     BJC_IDENTIFY_CARTRIDGE_REQUEST = 0x1
  315. } bjc_identify_cartridge_command_t;
  316. void bjc_put_identify_cartridge(P2(stream *s,
  317.                    bjc_identify_cartridge_command_t command));
  318.  
  319. /*
  320.  * Page commands.
  321.  */
  322.  
  323. /* Set page margins */
  324. /* Left margin is 1-origin; margins are both from left edge; indent <= 8 */
  325. void bjc_put_page_margins(P5(stream *s, int length10ths, int lm10ths,
  326.                  int rm10ths, int indent60ths));
  327.  
  328. /* Set extended margins */
  329. /* All values are 0-origin; margins are both from left edge; indent <= 8 */
  330. void bjc_put_extended_margins(P5(stream *s, int length60ths, int lm60ths,
  331.                  int rm60ths, int indent60ths));
  332.  
  333. /* Page ID */
  334. /* 0 <= id <= 127 */
  335. void bjc_put_page_id(P2(stream *s, int id));
  336.  
  337. /*
  338.  * Image commands.
  339.  */
  340.  
  341. /* Set raster compression */
  342. typedef enum {
  343.     BJC_RASTER_COMPRESSION_NONE = 0x0,
  344.     BJC_RASTER_COMPRESSION_PACKBITS = 0x1
  345. } bjc_raster_compression_t;
  346. void bjc_put_compression(P2(stream *s, bjc_raster_compression_t compression));
  347.  
  348. /* Set raster resolution */
  349. void bjc_put_raster_resolution(P3(stream *s, int x_resolution,
  350.                   int y_resolution));
  351.  
  352. /* Raster skip */
  353. /* Maximum skip on 6x0 and 4000 is 0x17ff */
  354. void bjc_put_raster_skip(P2(stream *s, int skip));
  355.  
  356. /* CMYK raster image */
  357. typedef enum {
  358.     BJC_CMYK_IMAGE_CYAN = 'C',
  359.     BJC_CMYK_IMAGE_MAGENTA = 'M',
  360.     BJC_CMYK_IMAGE_YELLOW = 'Y',
  361.     BJC_CMYK_IMAGE_BLACK = 'K',
  362. } bjc_cmyk_image_component_t;
  363. void bjc_put_cmyk_image(P4(stream *s, bjc_cmyk_image_component_t component,
  364.                const byte *data, int count));
  365.  
  366. /* Move by raster lines */
  367. /* Distance must be a multiple of the raster resolution */
  368. void bjc_put_move_lines(P2(stream *s, int lines));
  369.  
  370. /* Set unit for movement by raster lines */
  371. /* unit = 360 for printers other than 7000 */
  372. /* unit = 300 or 600 for 7000 */
  373. void bjc_put_move_lines_unit(P2(stream *s, int unit));
  374.  
  375. /* Set image format */
  376. /* depth is 1 or 2 */
  377. /****** DIFFERENT FOR 7000 ******/
  378. typedef enum {
  379.     BJC_IMAGE_FORMAT_REGULAR = 0x00,
  380.     BJC_IMAGE_FORMAT_INDEXED = 0x80
  381. } bjc_image_format_t;
  382. typedef enum {
  383.     BJC_INK_SYSTEM_REGULAR = 0x01,
  384.     BJC_INK_SYSTEM_PHOTO = 0x02,
  385.     BJC_INK_SYSTEM_REGULAR_DVM = 0x09,    /* drop volume modulation */
  386.     BJC_INK_SYSTEM_PHOTO_DVM = 0x0a    /* drop volume modulation */
  387. } bjc_ink_system_t;
  388. void bjc_put_image_format(P4(stream *s, int depth,
  389.                  bjc_image_format_t format,
  390.                  bjc_ink_system_t ink));
  391. /* 4550 only */
  392. void bjc_put_photo_image(P2(stream *s, bool photo));
  393.  
  394. /* Continue raster image */
  395. void bjc_put_continue_image(P3(stream *s, const byte *data, int count));
  396.  
  397. /* BJ indexed image */
  398. void bjc_put_indexed_image(P4(stream *s, int dot_rows, int dot_cols,
  399.                   int layers));
  400.  
  401. #endif                /* gdevcbjc_INCLUDED */
  402.